<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .a {
            width: 300px;
            height: 300px;
            background-color: red;
        }
    </style>
</head>

<body>
    <div class="a"></div>
    <script>
        var a = document.querySelector('.a')
        a.addEventListener('mousemove', jieliu())
        function jieliu() {
            var a = null
            return () => {
                if (!a) {
                  a = setTimeout(() => {
                        console.log(1);
                        a = null
                    }, 2000)
                }
            }
        }
    </script>
</body>

</html>